home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Text⁄Files
/
Writeswell Jr. 1.0.2 Master
/
WSI Library Source
/
MyGestalt.c
< prev
next >
Wrap
Text File
|
1992-04-23
|
2KB
|
91 lines
/* MyGestalt.c
* Wrapper functions that call Gestalt for various purposes.
* ©1992 Working Software, Inc.
* This source code is copyrighted. Permission is granted to use the Word Services
* portion of the Writeswell Jr. source code in your own programs, but you
* may not distribute the Writeswell Jr. word-processor code as a
* commercial product. If you modify the code, please do not call it
* Writeswell Jr. (or Writeswell.) This will ensure that people understand the
* program and don’t have to deal with a number of different versions with
* who-knows-what going on in the code.
*
* Writeswell Jr. and Writeswell are trademarks of Working Software, Inc.
* 1 Aug 91 Mike Crawford
*/
#include <Traps.h>
#include <GestaltEqu.h>
#include "MyGestalt.h"
#include "TrapAvail.h"
Boolean System7Installed( void )
{
OSErr err;
long response;
if ( !TrapAvailable( _GestaltDispatch ) )
return false;
/* Note that one is not supposed to infer the existence of a particular
* software feature from the system version. To use the alias manager, for
* example, we should check for it explicitly.
*/
err = Gestalt( gestaltSystemVersion, &response );
if ( err )
return false;
/* Gotcha! The < binds tighter than the &, so we must parenthesize! */
if ( ( response & 0x00000f00 ) < 0x00000700 )
return false;
return true;
}
Boolean AliasMgrPresent( void )
{
OSErr err;
long response;
long bitMask;
/* One should have already checked for Gestalt's existence before calling this */
err = Gestalt( gestaltAliasMgrAttr, &response );
if ( err )
return false;
/* Bit 0 is set in the response if the manager is present */
bitMask = 1;
bitMask << gestaltAliasMgrPresent;
if ( response & gestaltAliasMgrPresent )
return true;
return false;
}/* AliasMgrPresent */
Boolean FindFolderPresent( void )
{
OSErr err;
long response;
long bitMask;
/* One should have already checked for Gestalt's existence before calling this */
err = Gestalt( gestaltFindFolderAttr, &response );
if ( err )
return false;
/* Bit 0 is set in the response if the manager is present */
bitMask = 1;
bitMask << gestaltFindFolderPresent;
if ( response & bitMask )
return true;
return false;
}/* FindFolderPresent */